package com.example.feignserver;

import com.example.feignserver.service.EurekaClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhanghaidong
 */
@RestController
@EnableEurekaClient
@EnableFeignClients
@SpringBootApplication
public class FeignServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(FeignServerApplication.class, args);
    }

    @Autowired
    private EurekaClientService eurekaClientService;

    @RequestMapping(value = "/hello", method = RequestMethod.GET)
    public String hello(String name) {
        return eurekaClientService.hello(name);
    }

    @RequestMapping(value = "/hello2", method = RequestMethod.GET)
    public String hello2(String name) {
        return eurekaClientService.hello2(name);
    }
}
